home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / misc / ue312cmd.zip / EMACS.RC < prev    next >
Text File  |  1993-04-22  |  6KB  |  259 lines

  1. ;    EMACS.RC:    Standard MicroEMACS Startup program
  2. ;            for MicroEMACS 3.12 and above
  3. ;            (C)opyright 1987,92 by Daniel M Lawrence
  4. ;            Last Update: 12/28/92
  5.  
  6. set $discmd FALSE
  7. write-message "[Setting up....]"
  8.  
  9. ; If you screen "SNOWS", comment this line
  10.     set $flicker "FALSE"
  11.  
  12. ; To use an IBM-PC EGA card, uncomment the following line
  13. ;    set $sres "EGA"
  14.  
  15. ;    If you hate clocks or position counters, comment these
  16. set $timeflag TRUE
  17. set $posflag TRUE
  18.  
  19. ;    Set Default Global modes
  20.  
  21. add-global-mode "blue"
  22. add-global-mode "WHITE"
  23. ;bind-to-key meta-prefix `    ;for annoying keyboards with ` at the top left
  24.  
  25. ;    Toggle function key window display
  26.  
  27. store-procedure toggle-fkeys
  28.     !if %rcfkeys
  29.         !goto rcfoff
  30.     !endif
  31.  
  32. ;    toggle function key window on
  33.     save-window
  34.     1 next-window
  35.     !if &sequal $cbufname "emacs.hlp"
  36.         delete-window
  37.     !endif
  38.     !if ¬ &sequal $cbufname "Function Keys"
  39.         1 split-current-window
  40.         1 select-buffer "Function Keys"
  41.         add-mode "red"
  42.         !force 5 resize-window
  43.         1 goto-line
  44.     !endif
  45.     set %rcfkeys TRUE
  46.     !force restore-window
  47.     !if &sequal $cbufname "Function Keys"
  48.         next-window
  49.     !endif
  50.     write-message "[Function key window ON]"
  51.     !return
  52.  
  53.     ;Toggle the function key window off
  54. *rcfoff
  55.     save-window
  56.     1 next-window
  57.     !if &sequal "Function Keys" $cbufname
  58.         delete-window
  59.     !endif
  60.     !force restore-window
  61.     write-message "[Function key window OFF]"
  62.     set %rcfkeys FALSE
  63. !endm
  64.  
  65. ;    Bring up Online-help system
  66.  
  67. store-procedure get-help
  68.     set $discmd FALSE
  69.     source ehelp.cmd
  70.     set $discmd TRUE
  71. !endm
  72.  
  73. ;    Load a new page
  74.  
  75. store-procedure get-page-loader
  76.     !if &seq &find newpage.cmd ""
  77.         write-message "[Can not find NEWPAGE.CMD]"
  78.         !return
  79.     !endif
  80.     execute-file newpage.cmd
  81. !endm
  82.  
  83. ;procedure to clean out the current page (which is nothing right now)
  84.  
  85. store-procedure clean
  86.     ; nothing by default
  87. !endm
  88.  
  89. ;    Set up auto CMODE
  90.  
  91. store-procedure set-default-mode
  92.     set %rctmp &sin $cfname "."
  93.     !if &equ %rctmp 0
  94.         !return
  95.     !endif
  96.     set %rctmp &mid $cfname &add %rctmp 1 5
  97.     !if &or &seq %rctmp "c" &seq %rctmp "h"
  98.         add-mode "cmode"
  99.     !endif
  100.     !if &or &seq %rctmp "cpp" &seq %rctmp "hpp"
  101.         add-mode "cmode"
  102.     !endif
  103.     !if &or &seq %rctmp "mss" &seq %rctmp "txt"
  104.         add-mode "wrap"
  105.     !endif
  106. !endm
  107. set $readhook set-default-mode
  108.  
  109. ;    This function activates the function key window as
  110. ;    a legitimate place to call up function keys using the mouse
  111.  
  112. store-procedure mouse-clicks
  113.  
  114.     ;remember where we started, and do the mouse movement
  115.     save-window
  116.     !force mouse-move-down
  117.  
  118.     ;If not in the function key window... leave
  119.     !if ¬ &sequal $cbufname "Function Keys"
  120.         !return
  121.     !endif
  122.  
  123.     ;First pos is a screen reposition, let it through
  124.     !if &and &equ $xpos 0 &equ $ypos 0
  125.         restore-window
  126.         !return
  127.     !endif
  128.  
  129.     ;Find out what function key were gonna do
  130.     add-mode magic
  131.     2 forward-character
  132.     set %rctmp $search
  133.     !force search-reverse "[fF][0-9]"
  134.     !if &seq $status FALSE
  135.         delete-mode magic
  136.         set $search %rctmp
  137.         !return
  138.     !endif
  139.  
  140.     ;we are on the "f" or "F".  Get the function key type and number now
  141.     set $search %rctmp
  142.     set %fcase lower
  143.     !if &equ $curchar 70
  144.         set %fcase upper
  145.     !endif
  146.     1 forward-character
  147.     set %fnum &chr $curchar
  148.     1 forward-character
  149.     set %fnum &cat %fnum &chr $curchar
  150.     set %fnum &add %fnum 0
  151.     !if &equ %fnum 10
  152.         set %fnum "0"
  153.     !endif
  154.     set %fname &cat "FN" %fnum
  155.     !if &seq %fcase upper
  156.         set %fname &cat "S-" %fname
  157.     !endif
  158.  
  159.     ;save the function
  160.     set %rccmd &bind %fname
  161.     delete-mode MAGIC
  162.  
  163.     ;swallow the up-button
  164.     set %rctmp >c
  165.  
  166.     ;restore the window and exit
  167.     restore-window
  168.  
  169.     ;procedures don't need the square brackets
  170.     !if &seq &left %rccmd 1 "["
  171.         set %rccmd &mid %rccmd 2 &sub &len %rccmd 2
  172.         %rccmd
  173.         !return
  174.     !endif
  175.  
  176.     ;and then execute it
  177.     !force execute-named-command %rccmd
  178. !endm   
  179. macro-to-key mouse-clicks MSa
  180.  
  181. ;    ***** Rebind the Function key group
  182.  
  183. bind-to-key search-forward        FN1
  184. bind-to-key search-reverse        FN2
  185. bind-to-key hunt-forward        FN3
  186. bind-to-key hunt-backward        FN4
  187. macro-to-key toggle-fkeys        FN5
  188. macro-to-key get-help            FN6
  189. bind-to-key next-window         FN7
  190. macro-to-key get-page-loader        FN8
  191. bind-to-key save-file            FN9
  192. bind-to-key exit-emacs            FN0
  193.  
  194. bind-to-key execute-macro-10        S-FN1
  195. bind-to-key execute-macro-11        S-FN2
  196. bind-to-key execute-macro-12        S-FN3
  197. bind-to-key execute-macro-13        S-FN4
  198. bind-to-key execute-macro-14        S-FN5
  199. bind-to-key execute-macro-15        S-FN6
  200. bind-to-key execute-macro-16        S-FN7
  201. bind-to-key execute-macro-17        S-FN8
  202. bind-to-key execute-macro-18        S-FN9
  203. bind-to-key execute-macro-19        S-FN0
  204.  
  205. ;    bring up the function key window
  206.  
  207.     1 split-current-window
  208.     select-buffer "Function Keys"
  209.     insert-string "f1 search-> f2 <-search █    MicroEMACS:  Text Editor~n"
  210.     insert-string "f3 hunt->   f4 <-hunt   █ ~n"
  211.     insert-string "f5 fkeys    f6 help     █  Available function key Pages include:~n"
  212.     insert-string "f7 nxt wind f8 pg[    ] █    Word  Box  Emacs  Pascal  C  cObol Lisp~n"
  213.     insert-string "f9 save     f10 exit    █  [use the f8 key to load Pages]~n"
  214.     unmark-buffer
  215.     delete-window
  216.     set %rcfkeys FALSE
  217.  
  218.     !if &seq $os "UNIX"
  219.  
  220.         ;Allow mainframes to simulate function
  221.         ;keys with ^C<n> and ^C shifted-<n>
  222.         
  223.         store-procedure emulate-fkeys
  224.             !if ¬ $pending
  225.                 write-message "FN-"
  226.             !endif
  227.             set %rcchar >key
  228.             set %rcchar &sindex "1234567890!@#$%^&*()" %rcchar
  229.             !if &equ %rcchar 0
  230.                 write-message "[Not Bound]"
  231.                 !return
  232.             !endif
  233.             clear-message-line
  234.             set %rctmp "FN"
  235.             !if &gre %rcchar 10
  236.                 set %rctmp &cat "S-" %rctmp
  237.             !endif
  238.             set %rcchar &mid "12345678901234567890" %rcchar 1
  239.             set %rctmp &bind &cat %rctmp %rcchar
  240.             !if &seq &lef %rctmp 1 "["
  241.                 set %rctmp &mid %rctmp 2 &sub &len %rctmp 2
  242.                 run %rctmp
  243.                 !return
  244.             !endif
  245.             !force execute-named-command %rctmp
  246.         !endm
  247.  
  248.         macro-to-key emulate-fkeys ^C
  249.         
  250.     !endif
  251.  
  252.     !if &seq $os "MSWIN"
  253.         source "mewin.cmd"
  254.     !else
  255.         toggle-fkeys
  256.     !endif
  257.  
  258.     set $discmd TRUE
  259.